<template>
  <div id="app">
    <nav>
      <!-- router-link 就是a标签 -->
      <template v-for="item in links">
        <router-link :key="item.path" :to="item.path">{{ item.text }}</router-link>
        |
      </template>
      <!-- <router-link to="/layout/home">Home</router-link>
      |
      <router-link to="/layout/about">About</router-link>
      ｜
      <router-link to="/login">登陆页面</router-link>
      ｜
      <router-link to="/classify">分类页面</router-link> -->
    </nav>
    <!-- router-view 就是路由显示区域。这个标签在哪个地方，那么路由就显示在这个区域  -->
    <router-view />
  </div>
</template>
<script>
export default {
  data() {
    return {
      links: [
        {
          path: '/login',
          text: '登陆页面',
          icon: '',
        },
        {
          path: '/layout/home',
          text: '首页',
          icon: '',
        },
        {
          path: '/layout/about',
          text: '关于',
          icon: '',
        },
        {
          path: '/layout/classify',
          text: '分类',
          icon: '',
        },
        {
          path: '/layout/personCenter',
          text: '个人中心',
          icon: '',
        },
      ],
    }
  },
}
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
